import pymysql
import time
db=pymysql.connect(host="localhost",user='root',password='root',db='spiders')
cursor=db.cursor()
sql='insert into list(`title`,`link`,`imgurl`,`createtime`) values (%s,%s,%s,%s)'

try:
    cursor.execute(sql,('爬虫','http://touzitop.com','/d/file/image/3242.jpg',time.time()))
    db.commit()
except:
    db.rollback()
    print('插入失败')
db.close()